

import random
def get_random(rate):
    i = random.randint(-1000000000,1000000000)%100
    if i<(100*rate):
        return 1
    else:
        return 0

def init(people,rate):
    a=[]     #投票结果
    for i in range(people):
        a.append(get_random(rate[i]))    #根据比例生成随机数
    return a

def vote(Temptation, people, round, growth):
    rate = [Temptation]*people     #初始每个人的投票率
    a=init(people,rate)    #第一轮投票
    result = []    #要输出的所有投票率

    result.append(a.count(1) / people)

    for i in range(1,round):

        a = init(people,rate)
        result.append(a.count(1)/people)
    return result

if __name__ == '__main__':
    arr = ['against', 'accept']
    Temptation = 0.6   #投票率

    people = 1000
    round = 300
    growth = 0.0014

    a = vote(Temptation, people, round, growth)
    print(a)
